package com.hua.utils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.hua.bean.News;

public class PageDataSource {

	private static int pageSize = 20;
	private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	public static List<String> getDataSourceString(int pageNum) {
		int start = (pageNum - 1) * pageSize;
		List<String> list = new ArrayList<String>();
		for (int i = start + 1; i <= start + 20; i++) {
			list.add("新闻 " + i);
		}
		return list;
	}

	public static List<News> getDataSourceNews(int pageNum) {
		int start = (pageNum - 1) * pageSize;
		List<News> list = new ArrayList<News>();
		String date = sdf.format(new Date());
		for (int i = start + 1; i <= start + pageSize; i++) {
			list.add(new News("新闻 " + i, date));
		}
		return list;
	}
}
